<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
	$(document).ready(function(){
		if("${requestScope.modify}"=="수정"){
			$("#r_uploadFile").attr("src","${initParam.root }/upload/temp/${sessionScope.recipeContent.rvo.r_img_new}");
		}else{
			$("#r_uploadFile").attr("src","${initParam.imgRoot}${sessionScope.recipeContent.rvo.r_img_new}");
		 } 
		
		$("#main_arrow_next").click(function(){
			if("${requestScope.temSaveIs}"!="임시저장"){
				alert("임시저장 버튼을 누르세요");
				return false;
			}
			$("#pForm_1").submit();
		});
		//처음 페이지 이기 때문에 alert창을 띄움
		$("#main_arrow_prev").click(function(){
			alert("처음 페이지 입니다");
		});
		//메인 이미지 클릭시 팝업 열기
		$("#r_uploadFile").click(function(){
			window.open("${initParam.root }/recipe/imgPopup.jsp","","width=605,height=470,left=400,top=230");
		});
		$("#main_ok").click(function(){
			if("${requestScope.temSaveIs}"!="임시저장"){
				alert("임시저장 버튼을 누르세요");
				return false;
			}
			if(confirm("수정 하시겠습니까?")){
				$("input[name=command]").val("update_submit");
				$("#pForm_1").submit();
			}
		});
		// 작성 취소 버튼
		$("#main_cancle").click(function(){
			if(confirm("작성을 취소하시겠습니까?")){
				location.href="recipe.do?command=write_cancle";
			}
		});
		//임시 저장 버튼
		$("#temSave").click(function(){
			$("input[name=command]").val("temSave");
			$("#pForm_1").submit();
		});
	});
</script>
<style type="text/css">
	#main_subject_text{
		text-align: center;
	}
	#main_content_text{
		text-align: center;
	}
	
</style>
</head>
<body>
<div id="write_container">
<div id="main_page1"><img src="${initParam.root }/img/main/main-write-page1.gif"></div>
<div id="main_arrow_prev"><input type="image" src="${initParam.root }/img/main/main-write-prev.gif"></div>
<div id="main_arrow_next"><input type="image" src="${initParam.root }/img/main/main-write-next.gif"></div>
<div id="main_info_next"><img src="${initParam.root }/img/main/main-update-next-info.gif"></div>
<div id="main_ok"><input type="image" src="${initParam.root }/img/main/main-update-ok.gif"></div>
<div id="main_cancle"><input type="image" src="${initParam.root }/img/main/main-update-cancle.gif"></div>
	<div id="main_write_form">
 		<form id="pForm_1" action="recipe.do" method="post">
 		<input type="hidden" name="command" value="update">
 		<input type="hidden" name="page" value="2">
 		<input type="hidden" name="r_img_origin" id="r_img_origin" value="${sessionScope.recipeContent.rvo.r_img_origin}">
 		<input type="hidden" name="r_img_new" id="r_img_new" value="${sessionScope.recipeContent.rvo.r_img_new}">
 		<input type="hidden" name="r_img_thum" id="r_img_thum" value="${sessionScope.recipeContent.rvo.r_img_thum}">
	 		<div id="main_title"><input type="text" id="main_subject_text" name="r_title" value="${sessionScope.recipeContent.rvo.r_title}" /></div>
	 			<div id="main_img" align="center"><img src="${initParam.root }/img/main/main-write-img.jpg" name="r_uploadFile" id="r_uploadFile" style="cursor: pointer;"></div>
	 		<div id="main_comment"><pre><textarea id="main_content_text" align="middle" cols="75" rows="7" name="r_comment">${sessionScope.recipeContent.rvo.r_comment}</textarea></pre></div>
			<div class="main_temSave"><img src="${initParam.root }/img/main/main-update-temp.gif" id="temSave"></div>
 		</form>
 	</div>
</div>
</body>
</html>